<?php 
$CI =& get_instance();
$class = $CI->router->class;
$method = $CI->router->method;

if($CI->router->directory === 'admin/'){
    $menu_list = get_menu_list();
    $cur_domain = DOMAIN_ADMIN;
}else{
    $menu_list = get_menu_list_nursery();
    $cur_domain = DOMAIN_NURSERY;
}
 
?>

<div id="sidebar" class="sidebar responsive" data-sidebar="true" data-sidebar-scroll="true" data-sidebar-hover="true">
    <script type="text/javascript">
		try{ace.settings.check('sidebar' , 'fixed')}catch(e){}
	</script>

	<ul class="nav nav-list">
		<li class="<?php echo $class=='index' && $method=='index' ? 'active' : ''; ?>">
			<a href="<?php echo $cur_domain?>/index">
				<i class="menu-icon fa fa-tachometer"></i>
				<span class="menu-text"> 管理首页 </span>
			</a>

			<b class="arrow"></b>
		</li>
        <?php foreach($menu_list as $kk=>$vv){ ?>
		<li class="">
			<a href="#" class="dropdown-toggle">
				<i class="menu-icon fa fa-list"></i>
				<span class="menu-text"> <?php echo $kk;?> </span>

				<b class="arrow fa fa-angle-down"></b>
			</a>

			<b class="arrow"></b>

			<ul class="submenu">
			<?php if (!empty($vv)){?>
			    <?php foreach($vv as $e){ ?>
				<li class="<?php echo ($e['link'] == '/'.$class || $e['link'] == '/'.$class.'/'.$method) ? 'active' : ''; ?>">
					<a href="<?php echo $cur_domain.$e['link']?>">
						<i class="menu-icon fa fa-caret-right"></i>
						<?php echo $e['name'];?>
					</a>

					<b class="arrow"></b>
				</li>
			    <?php }?>
            <?php }?>
				
			</ul>
		</li>
		<?php }?>
		

		
	</ul><!-- /.nav-list -->

	<!-- #section:basics/sidebar.layout.minimize -->
	<div class="sidebar-toggle sidebar-collapse" id="sidebar-collapse">
		<i class="ace-icon fa fa-angle-double-left" data-icon1="ace-icon fa fa-angle-double-left" data-icon2="ace-icon fa fa-angle-double-right"></i>
	</div>

	<div class="sidebar-toggle sidebar-expand" id="sidebar-expand">
		<i class="ace-icon fa fa-angle-double-right" data-icon1="ace-icon fa fa-angle-double-right" data-icon2="ace-icon fa fa-angle-double-left"></i>
	</div>

	<!-- /section:basics/sidebar.layout.minimize -->
	<script type="text/javascript">
		try{ace.settings.check('sidebar' , 'collapsed')}catch(e){}
	</script>
	<script type="text/javascript">
    	$(".active").parents("li").addClass('active');
    	$(".active").parents("li").addClass('open');
    </script>
</div>

